//---------------------------------json
#include "jsoncpp_share.h"

void test_lib_json(void)
{

    //JsonObject <------------> string
    Json::Value j,ja;
    j["a"] = "123";
    j["b"] = 123;
    char ar[] = {1, 2, 3, 4, 5, 6, 7};
    for (int i = 0; i < sizeof(ar); i++)ja.append(ar[i]);
	j["arr"] = ja;
    std::string str = json2string(j);
    Json::Value jr;
    string2json(&jr, str.c_str());

    printf(" jr = %s", json2string(jr,false).c_str());

    //JsonObject <------------> file
    Json::json2file(j,"test.json");
    Json::Value jf;
    Json::jsonfromfile(jf,"test.json");
    std::cout << "json=" << jf.toStyledString() << std::endl;   
}
